As far as configurations of a rotary encoder are concerned, a configuration is known in which a housing of a rotary encoder houses a substrate on which a light emitting device, which emits light, is installed and a substrate on which a light receiving device, which detects the light emitted by the light emitting device, is installed (for example, Patent Literature 1).